/*     */ package com.qmsk.business.member.memberExcluServiceConsume.controller;
/*     */ 
/*     */ import com.qmsk.business.member.memberExcluServiceConsume.dao.memberExcluServiceConsumeDao;
/*     */ import com.qmsk.session.UserSessionInfo;
/*     */ import com.utils.basic.CDateTimeComm;
/*     */ import com.utils.basic.MapUtils;
/*     */ import com.utils.basic.ObjectComm;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.in.ParserDataSetJson;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.jdbc.connection.DbConnection;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.io.IOException;
/*     */ import java.util.Date;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.commons.lang.StringUtils;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/memberExclusiveServiceConsume"})
/*     */ public class memberExcluServiceConsume
/*     */ {
/*  42 */   private static final Logger logger = Logger.getLogger(memberExcluServiceConsume.class);
/*     */ 
/*     */   @Autowired
/*     */   private memberExcluServiceConsumeDao dao;
/*     */ 
/*     */   @RequestMapping(value={"find/memberExclusiveServiceConsumeList/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListMemberCouponDetail(HttpServletRequest request, HttpServletResponse response, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/*  60 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*  61 */     Map params = new HashMap();
/*     */ 
/*  63 */     Long shopId = RequestUtils.getLong(request, "shopId");
/*  64 */     MapUtils.addPercentToMap(params, "custName", RequestUtils.getString(request, "custName"));
/*  65 */     MapUtils.addPercentToMap(params, "mp", RequestUtils.getString(request, "mp"));
/*  66 */     MapUtils.addPercentToMap(params, "memberCard", RequestUtils.getString(request, "cord"));
/*  67 */     params.put("shopId", shopId);
/*  68 */     params.put("openId", RequestUtils.getString(request, "openId"));
/*  69 */     MapUtils.addToMap(params, "dtBegin", 
/*  70 */       RequestUtils.getString(request, "dtBegin"));
/*  71 */     MapUtils.addToMap(params, "id", 
/*  72 */       RequestUtils.getString(request, "id"));
/*  73 */     String dtEnd = RequestUtils.getString(request, "dtEnd");
/*  74 */     if (StringUtils.isNotEmpty(dtEnd))
/*  75 */       MapUtils.addToMap(params, "dtEnd", CDateTimeComm.getAddDay(
/*  76 */         CDateTimeComm.yymmddToDate(dtEnd), 1));
/*     */     try
/*     */     {
/*  79 */       GsonEbRst gsonEbRst = this.dao.getInsurancePloicy(params, nPageIdx, 
/*  80 */         nPageSize);
/*  81 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (Exception e) {
/*  83 */       logger.error(e);
/*  84 */       ResponseUtils.setErrorMsgResponse(
/*  85 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"insert"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insertMember(HttpServletRequest request, HttpServletResponse response)
/*     */     throws IOException
/*     */   {
/*     */     try
/*     */     {
/*  95 */       int nResult = 0;
/*  96 */       Long id = null;
/*  97 */       Date dCreate = new Date();
/*  98 */       String sData = RequestUtils.getStringOfData(request);
/*  99 */       String userName = 
/* 100 */         UserSessionInfo.getUserNameOfRequest(request);
/* 101 */       Long userId = UserSessionInfo.getIntUserIdOfRequest(request);
/* 102 */       ParserDataSetJson p = ParserDataSetJson.fromString(sData);
/* 103 */       if ((p != null) && (p.isExistsInsertRows())) {
/* 104 */         GsonHeadOneRow r = (GsonHeadOneRow)p.getListInsertRows().get(0);
/* 105 */         r.addHeadData("createFileTime", dCreate);
/* 106 */         r.addHeadData("createFileMan", userName);
/*     */ 
/* 108 */         nResult = this.dao.applyUpdates(p, "id");
/*     */       }
/* 110 */       if (nResult > 0) {
/* 111 */         id = ObjectComm.objectToLong(((GsonHeadOneRow)p.getListInsertRows().get(0)).getValueOfName("id"));
/*     */       }
/*     */ 
/* 114 */       if (nResult > 0) {
/* 115 */         DbConnection.commit();
/* 116 */         String[] head = { "id" };
/* 117 */         Object[] data = { id };
/* 118 */         ResponseUtils.toGsonEbRst(head, data, response);
/*     */ 
/* 120 */         return; }
/* 121 */       DbConnection.rollback();
/* 122 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 123 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 124 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 127 */       DbConnection.rollback();
/* 128 */       logger.error(e);
/* 129 */       ResponseUtils.setErrorMsgResponse(
/* 130 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 131 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"edit"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void edit(HttpServletRequest request, HttpServletResponse response) throws IOException
/*     */   {
/*     */     try
/*     */     {
/* 140 */       int nResult = 0;
/* 141 */       String sData = RequestUtils.getStringOfData(request);
/*     */ 
/* 143 */       ParserDataSetJson p = ParserDataSetJson.fromString(sData);
/* 144 */       if ((p != null) && (p.isExistsUpdateRows())) {
/* 145 */         nResult = this.dao.applyUpdates(p);
/*     */       }
/*     */ 
/* 148 */       if (nResult > 0) {
/* 149 */         DbConnection.commit();
/* 150 */         ResponseUtils.setSuccessResponse(response);
/*     */ 
/* 152 */         return; }
/* 153 */       DbConnection.rollback();
/* 154 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 155 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 156 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 159 */       DbConnection.rollback();
/* 160 */       logger.error(e);
/* 161 */       ResponseUtils.setErrorMsgResponse(
/* 162 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 163 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"del"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void del(HttpServletRequest request, HttpServletResponse response) throws IOException
/*     */   {
/*     */     try {
/* 171 */       String id = RequestUtils.getStringOfId(request);
/* 172 */       String[] ids = id.split(",");
/* 173 */       int nResult = this.dao.deleteParams(ids);
/* 174 */       if (nResult > 0) {
/* 175 */         DbConnection.commit();
/* 176 */         ResponseUtils.setSuccessResponse(response);
/*     */ 
/* 178 */         return; }
/* 179 */       DbConnection.rollback();
/* 180 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 181 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 182 */         response);
/*     */     }
/*     */     catch (Exception e) {
/* 185 */       DbConnection.rollback();
/* 186 */       logger.error(e);
/* 187 */       ResponseUtils.setErrorMsgResponse(
/* 188 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 189 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.member.memberExcluServiceConsume.controller.memberExcluServiceConsume
 * JD-Core Version:    0.5.3
 */